package com.cm.course.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cm.course.entity.ConsolidateQuestion;
import com.cm.course.service.ConsolidateService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author xdf
 * @date 2023-06-21
 */
@RestController
@RequestMapping("/consolidate")
public class ConsolidateController {
  @Resource ConsolidateService consolidateService;

  /**
   * 根据知识点和难度，分页获取练习题
   * @param point 0表示任意知识点
   * @param current
   * @param difficulty 0表示任意难度
   * @param size
   * @return
   */
  @GetMapping("/{point}/{difficulty}/{current}/{size}")
  public Page<ConsolidateQuestion> getConsolidateQuestionByPointOrDifficulty(
      @PathVariable String point,
      @PathVariable Long current,
      @PathVariable String difficulty,
      @PathVariable Long size) {
    return consolidateService.getConsolidateQuestionByPointOrDifficulty(
        point, difficulty, current, size);
  }
}
